package com.it.myh;

import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @Description: // 类说明，在创建类时要填写
 * @ClassName: Ev_0608_02    // 类名，会自动填充
 * @Author: MYH          // 创建者
 * @Date: 2023/6/8 15:43   // 时间
 * @Version: 1.0     // 版本
 */
public class Ev_0608_02 {
    public static void main(String[] args) {
        System.out.println("====================1===================");
        List<Integer> list = Arrays.asList(new Integer[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10});
        List<Integer> collect = list.stream()
                .filter(s -> s % 2 == 0)
                .collect(Collectors.toList());
        collect.stream().forEach(s -> System.out.println(s));
        System.out.println("====================2===================");
        List<String> list1 = Arrays.asList("zhangsan,23", "lisi,24", "wangwu,25");
        Map<String, String> collect1 = list1.stream()
                .filter(s -> Integer.parseInt(s.split(",")[1]) >= 24)
                .collect(Collectors.toMap(s -> s.split(",")[0], s -> s.split(",")[1]));
        System.out.println(collect1);
        System.out.println("====================3===================");
        List<String> man = Arrays.asList("张三,21", "张饿二,25", "李饿二,25", "孙饿二,25", "马饿二,25", "高饿二,25");
        List<String> wonmen = Arrays.asList("杨三,21", "杨饿二,25", "杨微软,25", "杨以体,25", "李胡源,25", "高二分,25");
        List<String> collect2 = man.stream()
                .filter(s -> s.split(",")[0].length() == 3)
                .limit(2)
                .collect(Collectors.toList());
        List<String> collect3 = wonmen.stream()
                .filter(s -> s.split(",")[0].startsWith("杨"))
                .skip(1)
                .collect(Collectors.toList());

    }

}
